package com.feige.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.feige.constant.Constants;
import com.feige.dao.FractionMapper;
import com.feige.pojo.Fraction;
import com.feige.pojo.vo.FractionVo;
import com.feige.result.AjaxResult;
import com.feige.service.FractionService;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 分数表 服务实现类
 * </p>
 *
 * @author feige
 * @since 2021-04-01
 */
@Service
public class FractionServiceImpl extends ServiceImpl<FractionMapper, Fraction> implements FractionService {

    @Override
    public AjaxResult getStuFraction(Integer pageNum, String exerciseTitleId) {
        IPage<FractionVo> page = new Page<>(pageNum, Constants.PAGE_SIZE * 4);
        this.baseMapper.getStuFraction(page,exerciseTitleId);
        AjaxResult success = AjaxResult.success(page.getRecords());
        success.put("total",page.getTotal());
        return success;

    }
}
